#!/usr/bin/python
# -*- coding: utf-8 -*-
# @author: 高建平
# @description: 
#

from typing import Any
from fastapi import HTTPException
from app.exceptions.status import Status


# 参数异常
class ParamException(HTTPException):

    def __init__(self, code: int = Status.HTTP_FAIL, message: str = None, detail: Any = None) -> None:
        """
        :param code 必须是在在status中定义好的值
        :param message 异常信息，通常可以展示给前端用户看
        :param detail 详细异常信息，通常是用于开发排查问题
        """
        self.code = code
        self.message = message
        super().__init__(code, detail)
    


class BizException(Exception):

    def __init__(self, code: int = Status.HTTP_FAIL, message: str = None, detail: Any = None) -> None:
        """
        :param code 必须是在在status中定义好的值
        :param message 异常信息，通常可以展示给前端用户看
        :param detail 详细异常信息，通常是用于开发排查问题
        """
        self.code = code
        self.message = message
        super().__init__(code, detail)
